<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台（PHP版）
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码，建议反馈是我们前进的动力
// | 开源版本可自由商用，可去除界面版权logo
// | gitee下载：https://gitee.com/likeshop_gitee/likeadmin
// | github下载：https://github.com/likeshop-github/likeadmin
// | 访问官网：https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------

namespace app\api\validate;

use app\common\validate\BaseValidate;

/**
 * 支付/转账验证器
 * Class PaymentValidate
 * @package app\api\validate
 */
class PaymentValidate extends BaseValidate
{
    protected $rule = [
        'id' => 'require|number',
//        'payment_date' => 'require|date',
        'currency' => 'require|max:20',
        'amount' => 'require|float|gt:0',
        'account' => 'require|max:100',
        'company_name' => 'max:150',
        'remarks' => 'max:255',
//        'status' => 'in:0,1,2,3,4',
        'files' => 'max:255',
    ];

    protected $message = [
        'id.require' => 'ID不能为空',
//        'payment_date.require' => '打款日期不能为空',
        'payment_date.date' => '打款日期格式错误',
        'currency.require' => '打款币种不能为空',
        'amount.require' => '打款金额不能为空',
        'amount.float' => '打款金额必须为数字',
        'amount.gt' => '打款金额必须大于0',
        'account.require' => '打款账户不能为空',
//        'status.in' => '状态值不正确',
    ];

    /**
     * @notes 创建打款记录场景
     * @return PaymentValidate
     * @author dev
     * @date 2024/03/31 11:20
     */
    public function sceneCreate()
    {
        return $this->only([ 'currency', 'amount', 'company_name', 'remarks'])
            ->remove('payment_date', 'require');
    }

    /**
     * @notes 获取打款记录详情场景
     * @return PaymentValidate
     * @author dev
     * @date 2024/03/31 11:20
     */
    public function sceneDetail()
    {
        return $this->only(['id']);
    }

    /**
     * @notes 更新打款记录状态场景
     * @return PaymentValidate
     * @author dev
     * @date 2024/03/31 11:20
     */
    public function sceneUpdateStatus()
    {
        return $this->only(['id', 'status', 'remarks']);
    }

    /**
     * @notes 删除打款记录场景
     * @return PaymentValidate
     * @author dev
     * @date 2024/03/31 11:20
     */
    public function sceneDelete()
    {
        return $this->only(['id']);
    }

    /**
     * @notes 上传打款凭证场景
     * @return PaymentValidate
     * @author dev
     * @date 2024/03/31 11:20
     */
    public function sceneUploadProof()
    {
        return $this->only(['id', 'files']);
    }
} 